package com.the4man.framework.base;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * Created by lenovo on 2017/12/12.
 */
public abstract class BaseService<T> implements IBaseService<T> {
    private BaseMapper<T> mapper;

    public BaseService() {
    }

    public void setBaseMapper(BaseMapper<T> mapper) {
        this.mapper = mapper;
    }

    public void setMapper(BaseMapper<T> mapper) {
        this.mapper = mapper;
    }

    public int insertModel(T model) throws Exception {
        return this.mapper.insert(model);
    }

    public int updateModel(T model) throws Exception {
        return this.mapper.update(model);
    }

    public T selectModelById(T model) throws Exception {
        return this.mapper.selectById(model);
    }

    public LinkedList<T> selectModel(T model) throws Exception {
        return this.mapper.select(model);
    }

    public LinkedList<T> selectModelForPage(T model) throws Exception {
        return this.mapper.selectForPage(model);
    }

    public LinkedList<T> selectModelForLimit(Map map) throws Exception {
        return this.mapper.selectForLimit(map);
    }

    public int deleteModel(List ids) throws Exception {
        return this.mapper.delete(ids);
    }

    public int updateStatusById(T model) throws Exception {
        return this.mapper.updateStatusById(model);
    }
}
